/**
 * 此文件包含对mockData.js的额外补充数据
 * 完全独立定义所有需要的数据，避免引用可能未定义的变量
 * 更新日期: 2025年6月11日
 */

// 导入 mockData 对象
import { mockData } from './mockData.fixed';

// 定义最近活动数据（独立于mockData.js中的定义）
const recentActivities = [
  { timestamp: '2025-06-09 14:23:45', description: '设备 AQM-123-01 报告空气质量优' },
  { timestamp: '2025-06-09 12:15:32', description: '用户 admin 登录系统' },
  { timestamp: '2025-06-08 18:42:11', description: '设备 AQM-456-02 发送告警：PM2.5 超标' },
  { timestamp: '2025-06-08 09:30:00', description: '系统完成每日数据备份' },
  { timestamp: '2025-06-07 16:45:22', description: '设备 AQM-789-03 离线' },
  { timestamp: '2025-06-07 10:12:05', description: '设备 AQM-101-04 维护完成' },
  { timestamp: '2025-06-06 15:38:17', description: '更新系统固件版本至 2.3.5' }
];

// 定义告警分布数据
const alertDistribution = [
  { name: 'PM2.5超标', value: 12 },
  { name: '电量不足', value: 8 },
  { name: '设备离线', value: 6 },
  { name: 'CO浓度异常', value: 4 },
  { name: '传感器故障', value: 3 },
  { name: '数据异常', value: 5 },
  { name: '通信异常', value: 7 },
  { name: 'TVOC超标', value: 4 },
  { name: '固件版本过低', value: 2 },
  { name: 'CO2超标', value: 9 }
];

// 定义设备使用数据
const deviceUsage = [
  { deviceName: 'AQM-123-01', userName: '张三', usageTime: 42, batteryLevel: 85, lastMaintenance: '2025-05-15', status: '正常', lastActive: '2025-06-09 14:23:45' },
  { deviceName: 'AQM-456-02', userName: '李四', usageTime: 36, batteryLevel: 15, lastMaintenance: '2025-04-20', status: '电量低', lastActive: '2025-06-09 10:45:12' },
  { deviceName: 'AQM-789-03', userName: '王五', usageTime: 28, batteryLevel: 45, lastMaintenance: '2025-06-01', status: '告警', lastActive: '2025-06-08 18:42:11' },
  { deviceName: 'AQM-101-04', userName: '赵六', usageTime: 48, batteryLevel: 65, lastMaintenance: '2025-06-07', status: '正常', lastActive: '2025-06-09 11:30:25' },
  { deviceName: 'AQM-205-05', userName: '钱七', usageTime: 15, batteryLevel: 92, lastMaintenance: '2025-05-25', status: '正常', lastActive: '2025-06-09 13:15:40' },
  { deviceName: 'AQM-302-06', userName: '孙八', usageTime: 52, batteryLevel: 78, lastMaintenance: '2025-05-10', status: '正常', lastActive: '2025-06-09 09:05:30' },
  { deviceName: 'AQM-417-07', userName: '周九', usageTime: 31, batteryLevel: 32, lastMaintenance: '2025-04-05', status: '警告', lastActive: '2025-06-08 16:22:18' },
  { deviceName: 'AQM-523-08', userName: '吴十', usageTime: 24, batteryLevel: 55, lastMaintenance: '2025-05-20', status: '正常', lastActive: '2025-06-09 08:44:52' }
];

// 告警数据专门格式化的响应对象 (针对 dashboard/alerts API)
mockData.dashboardAlerts = {
  data: {
    recentActivities: recentActivities,
    alertData: alertDistribution,
    todayAlertCount: 7,
    pendingAlertCount: 4,
    criticalAlertCount: 2  },
  success: true,
  message: '获取告警数据成功'
};

// 设备状态分布专门格式化的响应对象 (针对 dashboard/device-status API)
mockData.deviceStatusDashboard = {
  data: {
    deviceUsage: deviceUsage,
    statusDistribution: {
      online: 35,
      offline: 7,
      warning: 8,
      alarm: 3,
      total: 53
    },
    batteryStatus: {
      critical: 4,
      low: 9,
      medium: 15,
      high: 25
    }
  },
  success: true,
  message: '获取设备状态分布成功'
};

// 导出扩展后的mockData对象，确保它被引用
export default mockData;
